package com.example.interactivehouse;

import java.io.IOException;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class LightOutdoorsScreen extends Activity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.lightoutdoors);
		final Button light = (Button) findViewById(R.id.lightoutdoors);
		final Button home = (Button) findViewById(R.id.homelo);
		final Button on = (Button) findViewById(R.id.outdoorslon);
		final Button off = (Button) findViewById(R.id.outdoorsloff);
		on.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				// String get = null;
				// try {
				// String on = "light:on";
				// out.writeUTF(on);
				// get = in.readUTF();
				// if (get.equalsIgnoreCase(on)) {
				light.setBackgroundResource(R.drawable.lightoutdoorson);
				// }
				// System.out.println("the light now is:" + get);
				// } catch (IOException ioe) {
				// ioe.printStackTrace();
//				 }
			}
		});
		off.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				// String get = null;
				// try {
				// String on = "light:on";
				// out.writeUTF(on);
				// get = in.readUTF();
				// if (get.equalsIgnoreCase(on)) {
				light.setBackgroundResource(R.drawable.lightoutdoorsoff);
				// }
				// System.out.println("the light now is:" + get);
				// } catch (IOException ioe) {
				// ioe.printStackTrace();
				// }
			}
		});
		home.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				home.setBackgroundResource(R.drawable.hometap);
				Intent i = new Intent(LightOutdoorsScreen.this,
						InteraciveHouse.class);
				startActivity(i);
			}
		});
	}
}
